package org.flower.web.servlet;

import org.flower.bean.Collect;
import org.flower.dao.CollectDao;
import org.flower.dao.impl.CollectDaoImpl;
import org.flower.entity.User;
import org.flower.service.CollectSrevice;
import org.flower.service.impl.CollectServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet( value = "/DeleteCollectServlet.shtml")
public class DeleteCollectServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        User user= (User)request.getSession().getAttribute("user");
        String collectid=request.getParameter("id");
        CollectSrevice collectSrevice =new CollectServiceImpl();
        if(collectSrevice.UpdateCollect(user.getId(),Integer.parseInt(collectid))){
            response.sendRedirect("collect.jsp");
        }else {
            response.sendRedirect("collect.jsp");
        }
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
